<%include pub/head.html%>
	</head>

	<body>
		<%include pub/left-nav.html%>
			<div class="xu-main-bar">
				<%include pub/usernav.html%>
					<div class="xu-main-body">
						<h3><a href="/">进行中的作业 / </a>作业详情</h3>
						<div class="task-info">
							<div class="all-info-list row">
								<div class="row">
									<% var a=locals.user.classlist; var b=taskdata.classlist.toString(); var c=[];
										for(let j=0; j < a.length; j++){ if(b.indexOf(a[j].klassid._id) !==-1){
										c.push(a[j].klassid._id) } } %>
										<input type="hidden" id="classListVal" value="<%- c %>">
										<input type="hidden" id="taskIdVal" value="<%- taskdata._id %>">
										<div class="col-sm-3">作业名称：<span>
												<%- taskdata.title %>
											</span></div>
										<div class="col-sm-3">作业类型：<span>
												<%if(taskdata.types=='type1' ){%>
													课堂作业
													<%}else if(taskdata.types=='type2' ){%>
														家庭作业
														<%}else{%>
															赛事
															<%}%>
											</span>
										</div>
										<div class="col-sm-3">截止日期： <span id="endtime">
												<%- taskdata.endtime %>
											</span></div>
										<div class="timer">
											<div class="endtime" id="dateShow1">剩余时间： <span class="d"></span> 天 <span
													class="h"></span> 小时 <span class="m"></span> 分 <span
													class="s"></span> 秒 </div>
										</div>
								</div>
								<div class="col-sm-3" style="margin-top: 14px;">提交作品数量： <span>
										<%- worklist.length %> / <%- taskdata.worksNum %>
									</span>
									<%if(worklist.length < taskdata.worksNum){%>
										<span class="tj-status">未提交</span>
										<%}else{%>
											<span class="tj-status end">已提交</span>
											<%}%>
								</div>
								<div class="col-sm-12" style="margin-top: 14px;">作业要求：<%- taskdata.content %>
								</div>
								<%if(locals.user.status==3 && taskdata.video){%>
									<div class="col-sm-12" style="margin-top: 14px;">观看教学视频： <a class="stu-btn"
											target="_blank" href="/lessons/content/<%- taskdata.video._id %>">
											<%- taskdata.video.title %>
										</a> </div>
									<%}%>
										<%if(taskdata.templet.length> 0){%>
											<div class="col-sm-12" style="margin-top: 14px;">作业模板：</div>
											<div class="col-sm-12" style="margin-top: 14px;">
												<div class="form-template-list">
													<%let temlist=taskdata.templet; for(let i=0; i < temlist.length;
														i++){%>
														<div class="stu-form-template template-item">
															<a href="/build/editor.html?loadfiles=/scratch/loadfiles/<%- temlist[i].workid.localsname %>">
																<img
																	src="/unreleased/covers/<%- temlist[i].workid.covers %>">
																<p>
																	<%- temlist[i].workid.title %>
																</p>
															</a>
														</div>
														<%}%>
												</div>
											</div>
											<%}%>
												<%let lastime=new Date(taskdata.endtime).getTime() - new
													Date().getTime(); if(lastime> 0 ){%>
													<%if(worklist.length < taskdata.worksNum){%>
														<div class="col-sm-10" style="margin-top: 14px;">
															提交:&nbsp;&nbsp;&nbsp;
															<a href="javascript:;" class="stu-btn green"
																id="post-works-modal">提交作品 (未分享的作品)</a>
															<a href="javascript:;" class="stu-btn blue"
																data-toggle="modal"
																data-target="#localsWorkPost">从电脑中上传</a>
														</div>
														<%}%>
															<div class="task-status">进行中</div>
															<%}else{%>
																<div class="task-status">已结束</div>
																<%}%>
							</div>
						</div>
						<div class="works-list">
							<ul>
								<%for(let i=0; i < worklist.length; i++){%>
									<li>
										<div class="xu-card">
											<%if(worklist[i].isLocals==1){%>
												<a class="xu-content-img"><img src="/teacher-pro/none.jpg"
														width="100%"></a>
												<%}else{%>
													<a class="xu-content-img"
														href="/build/editor.html?school=<%- worklist[i].localsname %>"><img
															src="/teacher-pro/covers/<%- locals.user._id %>/<%- worklist[i].covers%>"
															width="100%"></a>
													<%}%>
														<div class="xu-list-border">
															<a class="xu-contant-title">
																<%- worklist[i].title %>
															</a>
															<p class="submitTime">提交时间：<%- worklist[i].time %>
															</p>
														</div>
														<div class="getpoint">
															<%if(worklist[i].ismarking){%>
																<div class="col-sm-12 wstatus-btn showpy"
																	wid="<%- worklist[i]._id %>">查看评语</div>
																<%}else{%>
																	<div class="col-sm-6 wstatus-btn disabled">待点评 <div
																			class="point-content"><span
																				class="bot"></span>老师正在批阅，请耐心等待。</div>
																	</div>
																	<%if(worklist[i].isLocals !=1){%>
																		<a href="/build/editor.html?school=<%- worklist[i].localsname %>"
																			class="col-sm-6 wstatus-btn">修改作业</a>
																		<%}%>
																			<%}%>
														</div>
										</div>
									</li>
									<%}%>
							</ul>
						</div>
					</div>
			</div>
			<!-- Modal -->
			<div class="modal fade modal-big" id="chooseWorkPost" tabindex="-1" role="dialog" data-backdrop="static"
				data-keyboard="false">
				<div class="modal-dialog" role="document" style="width: 730px">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close close-newclass" data-dismiss="modal"
								aria-label="Close"><span aria-hidden="true">&times;</span></button>
							<h4 class="modal-title">请选择您要提交的作品</h4>
						</div>
						<div class="modal-body row" id="stu-projects-list"></div>
						<div class="modal-footer">
							<button type="button" id="post-project-btn" class="xu-btn xu-btn-primary">确 认</button>
							<button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
						</div>
					</div>
				</div>
			</div>
			<!-- Modal -->
			<div class="modal fade" id="myworkpyMoadl" tabindex="-1" role="dialog" data-backdrop="static"
				data-keyboard="false">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close close-newclass" data-dismiss="modal"
								aria-label="Close"><span aria-hidden="true">&times;</span></button>
							<h4 class="modal-title">老师评语</h4>
						</div>
						<div class="modal-body row">
							<div class="row mb-10">
								<div class="flist-title">得分:</div>
								<div class="col-sm-10" id="myworkscore" style="color: #2c85f0;"></div>
							</div>
							<div class="row mb-10">
								<div class="flist-title">评语:</div>
								<div class="col-sm-10" id="myworkpy"></div>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关 闭</button>
						</div>
					</div>
				</div>
			</div>
			<!-- Modal -->
			<div class="modal fade" id="localsWorkPost" tabindex="-1" role="dialog" data-backdrop="static"
				data-keyboard="false">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close close-newclass" data-dismiss="modal"
								aria-label="Close"><span aria-hidden="true">&times;</span></button>
							<h4 class="modal-title">从电脑中上传</h4>
						</div>
						<div class="modal-body row">
							<div class="form-group">
								<label>请填写作品名称</label>
								<input type="text" class="form-control" placeholder="请填写作品名称" id="locals-pro-title">
							</div>
							<div class="form-group">
								<label>请选择一个作品</label>
								<input type="file" class="form-control" placeholder="选择一个作品" accept=".sb3, .py"
									id="locals-pro-file">
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" id="post-localspro-btn" class="xu-btn xu-btn-primary">确 认</button>
							<button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
						</div>
					</div>
				</div>
			</div>
			<%include pub/foot.html%>
				<script type="text/javascript" src="/school/js/timer.js"></script>
				<script type="text/javascript">
					var data = $('#endtime').text();
					$.leftTime(data, function (d) {
						var $dateShow1 = $("#dateShow1");
						if (d.status) {
							$dateShow1.find(".d").html(d.d);
							$dateShow1.find(".h").html(d.h);
							$dateShow1.find(".m").html(d.m);
							$dateShow1.find(".s").html(d.s);
						} else {
							$dateShow1.hide()
						}
					});

				</script>
	</body>

	</html>